package com.example.chatplatform.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface WebsocketMapper {

    @Insert("insert into crony_message(messaging_id, receive_id, message, message_time) " +
            "values (#{messagingId}, #{receiveId}, #{message}, #{messageTime})")
    void addCronyMessage(int messagingId, int receiveId, String message, String messageTime);

    @Select("select group_id from group_user where user_id = #{userId}")
    List<Integer> GroupId(Integer userId);

    @Insert("insert into group_message(group_id, user_id, message, message_time) " +
            "values (#{toId}, #{userId}, #{message}, #{messageTime})")
    void addGroupMessage(Integer toId, Integer userId, String message, String messageTime);
}
